<?php
    include '../connectDatabase.php';

    session_start();
    $ID = $_SESSION['userid'];
    $username = $_POST['username'];
    $passwd = $_POST['passwd'];
    $email = $_POST['email'];
    $sex = $_POST['sex'];
 
    $sql = "update users set user_name='$username',user_password='$passwd',user_sex='$sex',user_email='$email' where user_id='$ID'";
    $result=mysqli_query($conn, $sql);

    if($result){
        echo "<script>alert('修改成功');window.location.href='../Page/login.php';</script>" ;
    }else{
        echo "<script>alert('修改失败');history.go(-1);</script>";
    }
 ?>